/*
package org.itboys.mobile.service.mongo.front;

import org.itboys.mobile.common.SundayCommonConstants;
import org.itboys.mobile.entity.mongo.SundayPraiseRecord;
import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseMongoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

*/
/**
 * Created by zhangyang on 2017/12/29.
 * 圣代_点赞记录_service
 *//*

@Service
public class SundayFrontPraiseRecordService extends BaseMongoService<SundayPraiseRecord>{

    @Resource(name = "mobileDs")
    private MongoDataSource sundayDataSource;
    @Override
    protected MongoDataSource getMongoDataSource() {
        return sundayDataSource;
    }

    @Override
    protected Class<SundayPraiseRecord> getEntityClass() {
        return SundayPraiseRecord.class;
    }

    @Autowired
    private SundayFrontCommunityDynamicService communityCategotyService;


    */
/**
     * 校验是否存在点赞记录
     * @param memberId  登录用户id
     * @param className 实体名称
     * @param mainId    实体id
     * @return  点赞数
     *//*

    public Long check(Long memberId,String className,Long mainId){

        long count = getCount(memberId,className,mainId);

        return count;
    }

    */
/**
     * 保存点赞
     * @param memberId  用户id
     * @param className 实体名称
     * @param mainId    实体id
     * @return  返回实时的点赞数
     *//*

    public Long save(Long memberId,String className,Long mainId){
        Long praisePoint = getCount(memberId,className,mainId);
        if(praisePoint == 0){//无记录,则是点赞
            SundayPraiseRecord record = new SundayPraiseRecord();
            record.setOutClassName(className);
            record.setOutClassId(mainId);
            record.setMemberId(memberId);
            super.save(record);
        }else{//有记录,则是取消点赞
            Map<String,Object> param = new HashMap<String,Object>();
            param.put("memberId",memberId);
            param.put("outClassName",className);
            param.put("outClassId",mainId);
            super.delete(param);
        }

        //返回实时的点赞数
        praisePoint = getCount(memberId,className,mainId);

        return praisePoint;
    }

    */
/**
     * 获取点赞数量
     * @param memberId  用户id
     * @param className 实体名称
     * @param mainId    实体id
     * @return  点赞数量
     *//*

    public Long getCount(Long memberId,String className,Long mainId){
        Map<String,Object> param = new HashMap<String,Object>();
        param.put("isDeleted", SundayCommonConstants.NO);
        param.put("outClassName",className);
        param.put("memberId",memberId);
        param.put("outClassId",mainId);
        long count = super.count(param);

        return count;
    }

}
*/
